#include "fooditem.h"
#include "ui_fooditem.h"
#include <QToolButton>
FoodItem::FoodItem(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::FoodItem)
{
    ui->setupUi(this);
    connect(ui->btn_select,&QToolButton::clicked,this,[=](){
       emit selected(food);
    });
}
void FoodItem::update(Food food){
    ui->label_name->setText(food.name);
    ui->label_info->setText(food.info);
    ui->lable_image->showURLImage(food.pic);
    ui->label_alias->setText(food.alias);
    this->food = food;
}
FoodItem::~FoodItem()
{
    delete ui;
}
